const ejs = require("ejs");
const fs = require("fs");

const data = {
  goodsList: [
    {
      sku: "8900000 Coins",
      name: "Poppo Live Coins",
      icon: "https://pic.bittopup.com/apiUpload/4de2b9fc8b6b9669827bdab835e4fc7c.png",
      goodsId: 2446,
      discountText:
        "Original Price：1394.546 USD · Current Price Only：996.104 USD",
      reviewLink: "https://bittopup.com/reviews/Poppo-Live-Coins",
      link: "https://bittopup.com/reviews/Poppo-Live-Coins",
    },
    {
      sku: "500 Diamonds",
      name: "Bigo live Diamonds",
      icon: "https://pic.bittopup.com/apiUpload/e5dca85b2abc14c737d350de4e5f6f8d.png",
      goodsId: 2421,
      discountText:
        "Original Price：14.423 USD · Current Price Only：10.302 USD",
      reviewLink: "https://bittopup.com/reviews/bigo-live-diamonds",
      link: "https://bittopup.com/reviews/bigo-live-diamonds",
    },
    {
      sku: "240 Tokens",
      name: "Honor of Kings Tokens",
      icon: "https://pic.bittopup.com/apiUpload/c0fe094e87add02f7b73e81cec6700c2.png",
      goodsId: 2139,
      discountText: "Original Price：3.895 USD · Current Price Only：2.291 USD",
      reviewLink: "https://bittopup.com/reviews/Honor-of-Kings-Tokens-Global",
      link: "https://bittopup.com/reviews/Honor-of-Kings-Tokens-Global",
    },
    {
      sku: "300 + 25 UC",
      name: "PUBG Mobile UC",
      icon: "https://pic.bittopup.com/apiUpload/b680c409529a10acdadf8acb6ae63932.png",
      goodsId: 2079,
      discountText:
        "Original Price：10.877 USD · Current Price Only：4.336 USD",
      reviewLink: "https://bittopup.com/reviews/pubg-uc",
      link: "https://bittopup.com/reviews/pubg-uc",
    },
    {
      sku: "6480 + 1600 Genesis Crystals",
      name: "Genshin Impact Global",
      icon: "https://pic.bittopup.com/apiUpload/de0d9aff944f4a092f2eb266ab2743e6.jpg",
      goodsId: 2450,
      discountText:
        "Original Price：118.074 USD · Current Price Only：73.725 USD",
      reviewLink: "https://bittopup.com/reviews/genshin-impact",
      link: "https://bittopup.com/reviews/genshin-impact",
    },
    {
      sku: "253 + 25 Diamonds",
      name: "Mobile Legends: Bang Bang",
      icon: "https://pic.bittopup.com/apiUpload/014e6dc45d9b8ee6399df253894b183c.png",
      goodsId: 2090,
      discountText: "Original Price：6.455 USD · Current Price Only：4.292 USD",
      reviewLink: "https://bittopup.com/reviews/mobile-legends-diamonds",
      link: "https://bittopup.com/reviews/mobile-legends-diamonds",
    },
    {
      sku: "Express Supply Pass",
      name: "Honkai: Star Rail",
      icon: "https://pic.bittopup.com/apiUpload/6832a3fdd4ad5e4b5b3f0d87bab4b629.png",
      goodsId: 2267,
      discountText: "Original Price：5.721 USD · Current Price Only：3.811 USD",
      reviewLink: "https://bittopup.com/reviews/Honkai-Star-Rail",
      link: "https://bittopup.com/reviews/Honkai-Star-Rail",
    },
    {
      sku: "6590 + 659 Extra Echoes",
      name: "Identity V Echoes (Global)",
      icon: "https://pic.bittopup.com/apiUpload/20477d8b1344f7d8a1c28bc5d7ac8451.png",
      goodsId: 2110,
      discountText:
        "Original Price：105.200 USD · Current Price Only：75.018 USD",
      reviewLink: "https://bittopup.com/reviews/identity-v-echoes",
      link: "https://bittopup.com/reviews/identity-v-echoes",
    },
    {
      sku: "6500 + 320 Bonds",
      name: "Arena Breakout Bonds",
      icon: "https://pic.bittopup.com/apiUpload/340381428b6e232650436055951dcb67.png",
      goodsId: 2131,
      discountText:
        "Original Price：105.190 USD · Current Price Only：76.637 USD",
      reviewLink: "https://bittopup.com/reviews/Arena-Breakout-Bonds",
      link: "https://bittopup.com/reviews/Arena-Breakout-Bonds",
    },

    {
      sku: "2200 Diamonds",
      name: "Free Fire Diamonds",
      icon: "https://pic.bittopup.com/apiUpload/1cb619517336da87f28f9efac260f501.png",
      goodsId: 2067,
      discountText:
        "Original Price：26.325 USD · Current Price Only：20.250 USD",
      reviewLink: "https://bittopup.com/reviews/Free-Fire-Diamonds",
      link: "https://bittopup.com/reviews/Free-Fire-Diamonds",
    },
  ],
};

// 指定模板文件路径
const templatePath = "./index.html";

// 使用EJS渲染模板
ejs.renderFile(templatePath, data, (err, html) => {
  fs.writeFileSync("./output.html", html);
});
